package com.ideaction.game.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.File;
import java.io.IOException;

/**
 * 
 * @author ZGame
 * redission配置初始
 *
 */
@Configuration
public class RedissionConfig {

	@Value("${redis.redisson.config}")
	private String redissonConfigPath;

	@Bean
	public RedissonClient redisson() throws IOException {
		//URL url = RedissionConfig.class.getClassLoader().getResource(redissionConfigPath);
		File file = new File(redissonConfigPath);
		Config config = Config.fromYAML(file);
		return Redisson.create(config);
	}
}
